#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	int a=1, b=1, i=2;
	while (i<n) {
		int t=a;
		a=(a%10007+b%10007)%10007;
		b=t%10007;
		i++;
	}
	cout << a << endl;
	return 0;
}
